<template>
  <!--参数取值必须在标签内。不能单独在template内-->
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>个人就业信息</span>
        <el-button style="float: none; padding: 3px 0" type="text" v-on:click="practiceadd()">录入实践信息</el-button>
      </div>
      <div class="text item">
        {{'社会实践主题：'}}<el-input style="width:250px" v-model="userform.subject" ></el-input>
        {{'实践类别（0-个人/1-团队/2-院级立项/3-校级立项）：'}}<el-input style="width:140px" v-model="userform.ptype" ></el-input>
        {{'负责人（学号）：'}}<el-input style="width:140px" v-model="userform.principal" ></el-input>

      </div>
      <div class="text item">
        {{'团队编号：'}}<el-input style="width:140px" v-model="userform.team_id" ></el-input>
        {{'成员学号：'}}<el-input style="width:250px" v-model="userform.team" ></el-input>
        {{'指导教师：'}}<el-input style="width:250px" v-model="userform.teacher" ></el-input>
      </div>
      <div class="text item">
        {{'实践开始时间：'}}<el-input style="width:250px" v-model="userform.s_time" ></el-input>
        {{'实践结束时间：'}}<el-input style="width:250px" v-model="userform.e_time" ></el-input>
      </div>
      <div class="text item">
        {{'实践成果，（默认为“暂无”，报道截图、DV/原创作品链接、总结报告）：'}}<el-input style="width:250px" v-model="userform.acheive" ></el-input>
      </div>
    </el-card>
  </div>
</template>
<script>
export default {
  name: "PracticeAdd",
  props:['id'],
  data() {
    return {
        userform:{        subject:'',
                          ptype: '',
                          principal:"",
                          team_id:"",
                          team:"",
                          teacher:"",
                          s_time:"",
                          e_time:"",
                          acheive:"",
                 },
        }
  },
  methods: {
    show() {
      console.log(this.$route.params.id)
    },
    practiceadd(){
    var url='/practice/add';
    this.$http.post(url,this.userform).then((res) =>{
            console.log(res);
            var jsonObject = res.data;
            if(jsonObject.code==200){
             this.$notify.success({
                              title: "提示",
                              message: jsonObject.message,
                            });
            }
            else if(jsonObject.code==400){
            this.$notify.error({
                               title: "提示",
                               message: jsonObject.message,
                            });
            }
        })
        .catch((err) => {
                      this.$notify.error({
                        title: "错误",
                        message: "服务器内部错误",
                      });
                    });
    }
  }
}
</script>
<style scoped>
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both
}

.box-card {
  width: 1200px;
}
</style>
